#include<vector>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
vector<int>side[200002];
int ind[200002];
int point[200002];
int ans[200002];
queue<int>q;
int main(){
    int n,e;
    cin>>n>>e;
    for(int i=1;i<=e;i++){
        int a,b;
        cin>>a>>b;
        side[a].push_back(b);
        ind[b]++;
    }
    for(int i=0;i<n;i++){
        sort(side[i].begin(),side[i].end());
    }
    int num=0;
    for(int i=0;i<n;i++){
        if(ind[i]==0&&!point[i]){
            q.push(i);
        while(!q.empty()){
        int front=q.front();
        point[front]=1;
        q.pop();
        num++;
        ans[num]=front;
        for(int i=0;i<side[front].size();i++){
            ind[side[front][i]]--;
            if(!ind[side[front][i]]&&side[front][i]<front)q.push(side[front][i]);//大小比较否则用小根堆。
        }
    }
        }
    }
    if(num==n){
        for(int i=1;i<=n;i++)cout<<ans[i]<<" ";
    }
    else
     cout<<"unworkable project";
    return 0;
}